package day2018_lab02;


import java.util.Scanner;

public class Test21 {
        public static void main(String[] args) {
            System.out.println("请输入你的字符串：");
            Scanner sc =new Scanner(System.in);
            String string = sc.nextLine();
            System.out.println("请输入你想统计的字符频率：");

            String  target = sc.next();
            String [] result = string.split("");
           frequency(result,target);
        }
        public static void  frequency(String[] result,String ch){
            int count=0;
            for(int i=0;i<=result.length-1;i++){
                if(ch.equals(result[i])){
                    count++;
                }
            }
            System.out.println(ch+"频率是："+count+"/"+result.length);
        }
    }


